home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 1.iso / toolbox / documents / ELF / elf_getphdr3E.txt < prev    next >
Encoding:
Text File  |  1996-11-11  |  2.5 KB  |  64 lines

  1.  
  2. elf_getphdr(3E)                Silicon Graphics                elf_getphdr(3E)
  3.  
  4. NAME
  5.      elf_getphdr: elf32_getphdr, elf32_newphdr, elf64_getphdr, elf64_newphdr -
  6.      retrieve class-dependent program header table
  7.  
  8. SYNOPSIS
  9.      cc [flag ...] file ...  -lelf [library ...]
  10.  
  11.      #include <libelf.h>
  12.  
  13.      Elf32_Phdr *elf32_getphdr(Elf *elf);
  14.      Elf32_Phdr *elf32_newphdr(Elf *elf, size_t count);
  15.  
  16.      Elf64_Phdr *elf64_getphdr(Elf *elf);
  17.      Elf64_Phdr *elf64_newphdr(Elf *elf, size_t count);
  18.  
  19. DESCRIPTION
  20.      For a 32-bit class file, elf32_getphdr returns a pointer to the program
  21.      execution header table, if one is available for the ELF descriptor elf.
  22.  
  23.      elf32_newphdr allocates a new table with count entries, regardless of
  24.      whether one existed previously, and sets the ELF_F_DIRTY bit for the
  25.      table [see elf_flag(3E)].  Specifying a zero count deletes an existing
  26.      table.  Note this behavior differs from that of elf32_newehdr [see
  27.      elf32_getehdr(3E)], allowing a program to replace or delete the program
  28.      header table, changing its size if necessary.
  29.  
  30.      If no program header table exists, the file is not a 32-bit class file,
  31.      an error occurs, or elf is null, both functions return a null pointer.
  32.      Additionally, elf32_newphdr returns a null pointer if count is zero.
  33.  
  34.      The table is an array of Elf32_Phdr structures, each of which includes
  35.      the following members.
  36.  
  37.                   Elf32_Word      p_type;
  38.                   Elf32_Off       p_offset;
  39.                   Elf32_Addr      p_vaddr;
  40.                   Elf32_Addr      p_paddr;
  41.                   Elf32_Word      p_filesz;
  42.                   Elf32_Word      p_memsz;
  43.                   Elf32_Word      p_flags;
  44.                   Elf32_Word      p_align;
  45.  
  46.      The ELF header's e_phnum member tells how many entries the program header
  47.      table has [see elf_getehdr(3E)].  A program may inspect this value to
  48.      determine the size of an existing table; elf32_newphdr automatically sets
  49.      the member's value to count.  If the program is building a new file, it
  50.      is responsible for creating the file's ELF header before creating the
  51.      program header table.
  52.  
  53.      The 64-bit class works identically, simply replacing all instances of 32
  54.      in the description and table with 64.
  55.  
  56. Page 1                           Release 6.2
  57.  
  58. elf_getphdr(3E)                Silicon Graphics                elf_getphdr(3E)
  59.  
  60. SEE ALSO
  61.      elf(3E), elf_begin(3E), elf_flag(3E), elf_getehdr(3E).
  62.  
  63. Page 2                           Release 6.2
  64.